cmake_minimum_required(VERSION 3.0)
project(sdl2-libvlc)
set(CMAKE_CXX_STANDARD 11)
add_definitions(-std=c++11)

file(GLOB SOURCE_FILES
  "${CMAKE_CURRENT_SOURCE_DIR}/*.h"
  "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
)

add_executable(sdl2-libvlc ${SOURCE_FILES})

IF(WIN32)
  include_directories(sdl2-libvlc "${CMAKE_SOURCE_DIR}/vendor/sdl2/include/")
  include_directories(sdl2-libvlc "${CMAKE_SOURCE_DIR}/vendor/vlc/include/")
  target_link_libraries(sdl2-libvlc "${CMAKE_SOURCE_DIR}/vendor/sdl2/lib/x86/SDL2.lib")
  target_link_libraries(sdl2-libvlc "${CMAKE_SOURCE_DIR}/vendor/sdl2/lib/x86/SDL2main.lib")
  target_link_libraries(sdl2-libvlc "${CMAKE_SOURCE_DIR}/vendor/vlc/lib/libvlc.lib")
  target_link_libraries(sdl2-libvlc "${CMAKE_SOURCE_DIR}/vendor/vlc/lib/libvlccore.lib")
  #whyyyy...
  SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /SAFESEH:NO")
  SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} /SAFESEH:NO")
  SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /SAFESEH:NO")
  SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO")
  SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /SAFESEH:NO")
  SET(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL} /SAFESEH:NO")
  SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /SAFESEH:NO")
  SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO")
  SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} /SAFESEH:NO")
  SET(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "${CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL} /SAFESEH:NO")
  SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /SAFESEH:NO")
  SET(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO")
ELSE()
  set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
  find_package(LIBVLC REQUIRED)
  find_package(SDL2 REQUIRED)
  include_directories(sdl2-libvlc "${SDL2_INCLUDE_DIR}")
  include_directories(sdl2-libvlc ${LIBVLC_INCLUDE_DIR})
  target_link_libraries(sdl2-libvlc ${SDL2_LIBRARY})
  target_link_libraries(sdl2-libvlc ${LIBVLC_LIBRARY})
ENDIF()